package ch.unifr.diuf.webeng.taskmap.db;

import java.util.Date;
import java.util.List;

import com.mongodb.DBObject;

public class TestTaskDB {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
//		Task t = new Task("pepe","Meeting with Boss",new Date(),"46.825004","7.130291");
//		Task t2 = new Task("pepe","Meeting with Friends",new Date(110,11,2),"46.825304","7.132291");
		TaskMapDAO d = TaskMapDAO.getInstance();
//		d.saveTask(t);
//		d.saveTask(t2);
		List<Task> l = d.getTasksByUser("pepe");
		for(Task tt:l){
			System.out.println(tt);
		}
		System.out.println("by date:");
		List<Task> li = d.getTasksBetweenDates("pepe", new Date(110,11,3), new Date(110,11,5));
		for(Task tt:li){
			System.out.println(tt);
		}
		DBObject o = d.getTask();
		Task tr = d.convertDocToTask(o);
//		System.out.println(tr);
		String test = "test";
		PasswordService ss = PasswordService.getInstance();
		String ww = ss.encrypt(test);
		System.out.println(ss.encrypt(test));
		String we = ss.encrypt("test");
		System.out.println(we.equalsIgnoreCase(ww));
		System.out.println(d.registerUser("iliya", "parolata"));

		System.out.println(d.registerUser("iva", "pass"));
		System.out.println(d.getRegisteredUser("ivan", "pass"));
		
	}

}
